<?php
include_once('../bootstrap.php');
$categoria = ($_POST['id'])?Doctrine::getTable('categoria')->find($_POST['id']):new Categoria();
$categoria->setValue(utf8_decode($_POST['es']), 'es');
$categoria->setValue(utf8_decode($_POST['en']), 'en');
$categoria->setValue(utf8_decode($_POST['pt']), 'pt');
$categoria->save();
$result['id'] = $categoria->id;
$result['es'] = utf8_encode($categoria->getValue('es'));
$result['en'] = utf8_encode($categoria->getValue('en'));
$result['pt'] = utf8_encode($categoria->getValue('pt'));
$result = json_encode($result);
header("Content-type: application/json");
echo($result);
?>